//
//  MTSkillManageMent.m
//  ShiShiBang
//
//  Created by songbaoqiang on 16/9/1.
//  Copyright © 2016年 motianjituan. All rights reserved.
//

#import "MTSkillManageMent.h"
#import "MTLoginViewController.h"

@interface MTSkillManageMent ()
@property (nonatomic ,strong)UITableView *merchantTableView;

@end

@implementation MTSkillManageMent
- (void)viewDidLoad {
//    [self initView];
//
    self.view.backgroundColor = [UIColor yellowColor]; 
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    MTLoginViewController *vc = [[MTLoginViewController alloc] init];
    [self presentViewController:vc animated:YES completion:nil];
//    [self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - 初始化tableView
-(void)initView{
    //筛选
    UIView *filterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, MTScreenW, 40)];
    filterView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:filterView];
    
    NSArray *filterName = @[@"全部分类",@"全城",@"智能排序"];
    //筛选
    for (int i = 0; i < 3; i++) {
        //文字
        UIButton *filterBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        filterBtn.frame = CGRectMake(i*MTScreenW/3, 0, MTScreenW/3-15, 40);
        filterBtn.tag = 100+i;
        filterBtn.titleLabel.font = [UIFont systemFontOfSize:13];
        [filterBtn setTitle:filterName[i] forState:UIControlStateNormal];
        [filterBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [filterBtn setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
        [filterBtn addTarget:self action:@selector(OnFilterBtn:) forControlEvents:UIControlEventTouchUpInside];
        [filterView addSubview:filterBtn];
        
        //三角
        UIButton *triangleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        triangleBtn.frame = CGRectMake((i+1)*MTScreenW/3-15, 16, 8, 7);
        triangleBtn.tag = 120+i;
        [triangleBtn setImage:[UIImage imageNamed:@"icon_arrow_dropdown_normal"] forState:UIControlStateNormal];
        [triangleBtn setImage:[UIImage imageNamed:@"icon_arrow_dropdown_selected"] forState:UIControlStateSelected];
        [filterView addSubview:triangleBtn];
    }
    //下划线
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 39.5, MTScreenW, 0.5)];
    lineView.backgroundColor = RGB(192, 192, 192);
    [filterView addSubview:lineView];
//    
//    self.merchantTableView = [UITableView initWithTableView:CGRectMake(0, 40, MTScreenW, SCREENHEIGHT-64) withDelegate:self];
//    [self.view addSubview:self.merchantTableView];
//    
//    self.imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT)];
//    self.imageView.image = [UIImage imageNamed:@"Default"];
//    self.imageView.hidden = YES;
//    [self.view addSubview:self.imageView];
//    
}

-(void)OnFilterBtn:(UIButton *)sender{
  
    for (int i = 0; i < 3; i++) {
        UIButton *menubtn = (UIButton *)[self.view viewWithTag:100+i];
        UIButton *arrowBtn = (UIButton *)[self.view viewWithTag:120+i];
        menubtn.selected = NO;
        arrowBtn.selected = NO;
    }
    sender.selected = YES;
    UIButton *sjBtn = (UIButton *)[self.view viewWithTag:sender.tag+20];
    sjBtn.selected = YES;
//    _maskView.hidden = NO;
    
}
@end
